package 每日一题;

public class 检测大写字母 {
    public boolean detectCapitalUse(String word) {
        int num =0;
        for (int i=0;i<word.length();i++){
            if (word.charAt(i)>='A' && word.charAt(i)<='Z'){
                num++;
            }
        }
        return num==word.length() || num == 0 || (num==1 && word.charAt(0)>='A' && word.charAt(0)<='Z');
    }
}
